import { _decorator, Component, dragonBones, Node } from 'cc';
import { Global } from './Global';
const { ccclass, property } = _decorator;

@ccclass('Lightning')
export class Lightning extends Component {
    @property(Node)
    ndAni: Node;
    attack: number;
    private _display: dragonBones.ArmatureDisplay;

    protected onLoad(): void {
        this._display = this.ndAni.getComponent(dragonBones.ArmatureDisplay);
    }

    protected onEnable(): void {
        this._display.on(dragonBones.EventObject.COMPLETE, this.onLightningComplete, this);
    }
    protected onDisable(): void {

    }

    onLightningComplete() {
        Global.putNode(this.node);
    }

    startLightning() {
        this._display.playAnimation('Sprite', 1);
    }
    start() {

    }

    update(deltaTime: number) {

    }
}


